# nginx php composer 
FROM centos:7

MAINTAINER NGINX LARAVEL Docker Maintainers "108464453@qq.com"

RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && \
    #rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm && \
    #rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && \

    #yum install -y epel-release && \
    #yum update && \
    yum install -y nginx && \
    rm -rf /etc/nginx/nginx.conf && \
    #yum install -y --enablerepo=webtatic-testing php71w-fpm php71w-opcache php71w-cli php71w-gd php71w-imap php71w-mysqlnd php71w-mbstring php71w-mcrypt php71w-pdo php71w-pecl-apcu php71w-pecl-mongodb php71w-pecl-redis php71w-pgsql php71w-xml php71w-xmlrpc && \
    #yum install -y --enablerepo=webtatic-testing php70w-fpm php70w-opcache php70w-cli php70w-gd php70w-imap php70w-mysqlnd php70w-mbstring php70w-mcrypt php70w-pdo php70w-pecl-apcu php70w-pecl-mongodb php70w-pecl-redis php70w-pgsql php70w-xml php70w-xmlrpc && \
    yum install -y --enablerepo=webtatic-testing php56w-fpm php56w-opcache php56w-cli php56w-gd php56w-imap php56w-mysqlnd php56w-mbstring php56w-mcrypt php56w-pdo php56w-pecl-apcu php56w-pecl-mongodb php56w-pecl-redis php56w-pgsql php56w-xml php56w-xmlrpc && \
    chkconfig php-fpm on && \
    php -v && \
    php -m && \
    
    # Install composer (PHP dep. manager)
    curl -sS https://getcomposer.org/installer | php && \
    mv composer.phar /usr/local/bin/composer && \
    
    # www data
    mkdir -p /data
    
#RUN yum install -y php71w-bcmath 
#RUN yum install -y php70w-bcmath   
RUN yum install -y php56w-bcmath

ADD index.php /usr/share/nginx/html/
ADD ocp.php /usr/share/nginx/html/
ADD phptangzhen.php /usr/share/nginx/html/
ADD nginx.conf /etc/nginx/
ADD www.conf /etc/php-fpm.d/
ADD php.ini /etc/

#COPY crontab /etc/cron.d/
#RUN chmod -R 644 /etc/cron.d/

VOLUME ["/data/", "/usr/share/nginx/html/", "/etc/nginx/", "/etc/nginx/conf.d/", "/etc/cron.d/crontab/"]

WORKDIR /data/
    
EXPOSE 80 8080 8081 443

#Start
ADD start.sh /
RUN chmod +x /start.sh

#Start it
ENTRYPOINT ["/start.sh"]
    
#CMD php-fpm && nginx -g "daemon off;"
##CMD ["/usr/sbin/nginx", "-g", "daemon off;"]